package com.itheima.interface1.homework.text3;
/*
定义Person类 生成空参有参构造，set和get方法 属性：（姓名，年龄）
行为：keepPet( ????? ,String something)方法​ 功能：喂养【宠物狗】和【宠物猫】，
问号处自己思考，something表示喂养的东西
 */
public class Person {
    private String  name;
    private int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    //年龄为30岁的老王养了一只黑颜色的2岁的宠物
    public void keepPet(Animal a,String something){
        System.out.println("年龄为"+age+"岁"+name+"养了一只"+a.getColor()+"的"+a.getAge()+"岁的宠物");
        a.eat(something);
    }
}
